# Session.LogMessage(Text, Text, Verbosity, DataClassification, TelemetryScope, Dictionary of [Text, Text]) Method
> Version: _Available or changed with runtime version 5.4._
Logs a trace message to a telemetry account.
## Syntax
```al
 Session.LogMessage(EventId: Text, Message: Text, Verbosity: Verbosity, DataClassification: DataClassification, TelemetryScope: TelemetryScope, CustomDimensions: Dictionary of [Text, Text])
```
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
EventId
Type: ../text/text-data-type
The event ID of trace message.
Message
Type: ../text/text-data-type
The message logged into telemetry.
Verbosity
Type: ../verbosity/verbosity-option
The verbosity of the log.
DataClassification
Type: DataClassification<../../../developer>
Classification of data in message.
TelemetryScope
Type: ../telemetryscope/telemetryscope-option
Specifies the scope of this trace message:
 ExtensionPublisher: Will emit this trace message to the Extension Publisher's telemetry account.
 All: Will emit this trace message additionally to the Partner's telemetry account.
CustomDimensions
Type: Dictionary of [Text, Text]<../dictionary/dictionary-data-type>
Set of additional dimensions, specified as a dictionary, that will be emitted to the telemetry account and that can be used to specify filters in the query.
## Remarks
For more information about using this method, see Creating Custom Telemetry Events for Application Insights<../../devenv-instrument-application-for-telemetry-app-insights>.
## Example
```al
trigger OnRun();
var
    CustomDimensions: Dictionary of [Text, Text];
begin
    CustomDimensions.Add('result', 'failed');
    CustomDimensions.Add('reason', 'critical error in code');
    CustomDimensions.Add('alCallstack', "Error Message Management".GetCurrCallStack());
    LogMessage('MyExt-0001', 'This is a critical error message', Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, CustomDimensions);
end;
```
## Related information
session-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/session/session-logmessage-string-string-verbosity-dataclassification-telemetryscope-dictionary[text,text]-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/session/session-logmessage-string-string-verbosity-dataclassification-telemetryscope-dictionary[text,text]-method/
